package main

import (
	"fmt"
)

// 四种变量声明
var e int = 40

func goVariant() {
	//1. 声明变量，默认值为0
	var a int
	fmt.Println("a = ", a)
	fmt.Printf("a type: %T\n", a)

	//2. 声明并赋值
	var b int = 10
	fmt.Println("b = ", b)
	fmt.Printf("b type: %T\n", b)

	//3. 声明并初始化,自动推导类型
	var c = 20
	fmt.Println("c = ", c)
	fmt.Printf("c type: %T\n", c)

	//4. 声明并初始化,自动推导类型，但是只能用在函数体内
	d := 30
	fmt.Println("d = ", d)
	fmt.Printf("d type: %T\n", d)

	fmt.Println("e = ", e)
	fmt.Printf("e type: %T\n", e)

	//声明多个变量
	var xx,yy int = 100,200
	var zz = 300
	fmt.Println("xx = ", xx,"yy = ", yy,"zz = ", zz)
}


